{% extends "base.html" %}

{% block title %}{{device.name}}{% endblock %}

{% block head %}
<link href="/medias/css/device.css" rel="stylesheet" type="text/css"/>
<script src="/medias/js/jquery.raty.min.js"></script>
<script type="text/javascript">
$(function() {

   $('#star').raty({
		showHalf: true,
		start:"{{score_val}}",
		hintList:     ['太差', '差', '一般', '好', '非常好'],
		readOnly:("{{device.isStar}}"!="0"),
		onClick: function(score) {
			
			$.ajax({
			   type: "POST",
			   url: "/device/star/",
			   data:{"devid":"{{device.id}}","star":score},
			   success: function(result){
			   	
			   	  if(result=="need login")
				  {
				  	alert("您还没有登录，请登录后评分");
				  }
				  else
				  {
				  	$.fn.raty.start(parseInt(result));
					$.fn.raty.readOnly(true); 
				  }
			      
			   }
			}); 
		}
	});

});

</script>
{% endblock %}

{% block left_content %}
<div id="midLeft">
	
    <div id="device_detail">
    <div class="title"><h2>{{device.name}}</h2></div>
    <div class="pic"><img  src="{{device.image.url_125x125|default:"image/default.jpg"}}" /></div>
	<ul class="info">
		<li>厂商：{{device.company}}</li>
		<li>厂商网站：<a href="{{device.company_url}}">{{device.company_url}}</a></li>
		<li>发布时间：{{device.pubdate}}</li>
		<li>标签：{% for tag in tags %}<a href="#">{{tag.name}}</a>{% endfor %}</li>
		<li>评分：<span style="margin-top:10px;" id="star"></span><span<span style="margin-left:20px;">{{score_val}}</span> <span style="margin-left:10px;">共{{stat_count}}人参与评分</span></li>
	</ul>
    <ul class="intro">
        <li><h3>简介：</h3>{{device.summary|linebreaksbr}}</li>
    </ul>  	
	<ul class="status">
		<li><a href="#">{{device.using}}人在用</a></li>
		<li><a href="#">{{device.want}}人想用</a></li>
		<li><a href="#">{{device.follow}}人关注</a></li>
		<li><a href="#">{{device.rec}}人推荐</a></li>
		<li><a href="#">{{device.like}}人喜欢</a></li>
	</ul>
	<ul class="action">
		<li class="corner"><a href="#">关注</a></li>
		<li class="corner"><a href="#">想用</a></li>
		<li class="corner"><a href="#">在用</a></li>
		<li class="corner"><a href="/device/comment/add/{{device.id}}">发表评论</a></li>
	</ul>	
	
	</div>

</div>

<div id="midLeft">
<h3><span class="sLeft">对{{device.name}}的最新评论</span><span class="sRight"></span></h3>	
{% for comment in comments  %}
<div id="comment{{comment.id}}">	
	<div id="device_comment">
		<img alt="{{comment.user.username}}" src="/medias/{{comment.user_image}}" />
		<div class="op_comment">
			{% ifequal request.user.username comment.user.username%}
		    <a href="javascript:void(0);" onclick="delete_comment('{{comment.id}}');"><img src="/medias/images/delete_note.gif"/></a> 
			{% endifequal %}
		</div>
		<div class="comment_text"><a href=" #">{{comment.user.username}}</a>:&nbsp&nbsp;{{comment.content|escape|linebreaksbr}}......</div>
	</div>	
</div>
{% endfor %}
</div >


<div id="midLeft">
	<h3><span class="sLeft">手机图片(共{{dev_photo_count}}张)</span><span class="sRight"><a href="/device/photo/add/">添加图片</a></span></h3>
	<ul class="imgPro">
		{% for photo in dev_photos %}
		<li><a href="/device/photo/{{photo.id}}" ><img alt="{{photo.name}}" width=140 height=140 src="/medias/{{photo.path}}"/></a></li>
		{% endfor %}		
	</ul>
</div>

{% endblock %}



{% block right_content %}
{% endblock %}
